package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class operationAdd implements Ioperation{
    public void work(BookList bookList){
        Scanner in = new Scanner(System.in);
        if(bookList.isbookFull()){

            System.out.println("书架满了");

        }
        else {


            System.out.println("新增图书:");

            System.out.println("请输入你要新增的书名:");
            String name = in.nextLine();

            System.out.println("请输入你要新增图书色作者:");
            String thname = in.nextLine();

            System.out.println("请输入你要新增图书的价格:");
            int prise = in.nextInt();

            System.out.println(in.nextLine());

            System.out.println("请输入你要新增图书的类型:");

            String type = in.nextLine();

            Book book = new Book(name,thname,prise,type);
            int currentSize = bookList.getUsesize();

            bookList.setBooks(currentSize,book);
            bookList.setUsesize(currentSize+1);
            System.out.println("新增图书成功");


        }

    }

}
